package osSRC.schedule;

public class DynamicPriorityPCB extends PCB{
	static final int D_PRIORITY_CALL=3;
	DynamicPriorityPCB(){}
	DynamicPriorityPCB(String name,int needTime){
		super(name,needTime);
		this.priority=50-needTime;
	}
	@Override
	int call(int timeSlice) {
		this.state="R";
		System.out.println(this);
		this.needTime-=timeSlice;
		this.CPU_Time+=timeSlice;
		this.priority-=timeSlice;
		return timeSlice;
	}
	@Override
	int wait(int timeSlice) {
		this.state="W";
		this.priority+=timeSlice;
		return 0;
	}

	@Override
	public String toString() {
		return super.toString()+this.priority;
	}
}
